package com.hfh.death_lock;

public class AccountTest {
    public static void main(String[] args) throws InterruptedException {
        Account src = new Account();
        src.setBalance(5000);
        Account target = new Account();
        target.setBalance(3000);

        // 3000 -> 4000
        // 5000 -> 4000
        AccountThread t1 = new AccountThread("交水电费", src, target, 2000);
        AccountThread t2 = new AccountThread("发工资", target, src, 1000);
        t1.start();
        t2.start();

        t1.join();
        t2.join();

        System.out.println(src.getBalance());
        System.out.println(target.getBalance());
    }
}